<template>
  <uv-modal ref="modalRef" :title="undefined" :closeOnClickOverlay="false">
    <view class="close-icon-wrap" @click="handleClose">
      <uv-icon name="close" color="#C3C3C3" size="24rpx"></uv-icon>
    </view>

    <view class="popup-body fs-34 text-center">
      <view>请确认</view>
      <view>订单号：{{orderData.orderNumber}}的订单已完成该工序！</view>
    </view>

    <view class="popup-footer" slot="confirmButton">
      <button class="confirm-button uv-reset-button flex-center-center" @click="handleSubmit">确认提交</button>
    </view>
  </uv-modal>
</template>

<script>
export default {
  name: 'ConfirmPopup',
  props: ['orderData'],
  data() {
    return {}
  },
  mounted() {
    this.$nextTick(() => {
      this.$refs.modalRef.open()
    })
  },
  methods: {
	handleClose(){
		this.$refs.modalRef.close()
		
		this.$emit('childEventClose', '');
	},
    handleSubmit() {
	  this.$api.makeOrder({
	  	id:this.orderData.id,
	  	
	  }).then(res=>{
	  	uni.showToast({
	  		title: '操作成功',
	  		icon: 'none'
	  	})
	  	this.$refs.modalRef.close()
		this.$emit('childEvent', this.orderData.id);
	  })
    },
  },
}
</script>

<style lang="scss" scoped>
.close-icon-wrap {
  position: absolute;
  top: 0;
  right: 0;
  padding: 36rpx;
}
.popup-body {
  width: 352rpx;
  line-height: 56rpx;
  color: #0e0e0e;
}
.popup-footer {
  padding-bottom: 46rpx;
}
.confirm-button {
  width: 218rpx;
  height: 76rpx;
  background: #ff4c2a;
  border-radius: 10rpx;
  font-weight: 500;
  font-size: 30rpx;
  color: #fff;
}
</style>
